package com.csh.club.gateway.enums;


import lombok.Getter;

@Getter
public enum ResultCodeEnum {
    //枚举类的对象名称，定义多少个就有多少个对象
    SUCCESS(200,"操作成功"),
    FAIL(500,"操作失败");

    private int code;
    private String msg;

    ResultCodeEnum(int code , String msg){
        this.code = code;
        this.msg = msg;
    }


    public static ResultCodeEnum getByCode(int codeValue){
        for(ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()){
            if (resultCodeEnum.code == codeValue){
                return resultCodeEnum;
            }
        }
        return null;
    }
}
